const Storage = require('../../utils/storage');
Page({
  data: {
    result: {
      playerA: { nickName: '', avatarUrl: '', score: 0 },
      playerB: { nickName: '', avatarUrl: '', score: 0 },
      winner: ''
    }
  },
  onLoad(query) {
    // idx为历史记录索引
    if (query.idx !== undefined) {
      const list = Storage.get('historyList', []);
      const item = list[query.idx] || {};
      this.setData({ result: item });
    }
  },
  onShare() {
    wx.showToast({ title: '敬请期待', icon: 'none' });
  },
  onBack() {
    wx.reLaunch({ url: '/pages/index/index' });
  }
});
